<template>
    <view>
        <form>
            <view class="cu-form-group margin-top">
                <view class="title">店铺名</view>
                <input placeholder="店铺名" name="input" v-model="dianbu.dianbu_name"></input>
            </view>
            <view class="cu-form-group">
                <view class="title">店铺负责人</view>
                {{dianbu.dianbu_user}}
            </view>
            <view class="cu-form-group align-start">
                <view class="title">店铺描述</view>
                <!-- {{this.$store.getters.isLogin}} -->
                <textarea maxlength="-1"  v-model="dianbu.dianbu_des" placeholder="店铺描述"></textarea>
            </view>

        </form>
        <view class="padding flex flex-direction">
            <button class="cu-btn bg-red margin-tb-sm lg" @tap="goDianPu">嫣红</button>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                dianbu : {
                    /*
                    dianbu_des varbinary(1000) comment ‘店铺描述’,
                    dianbu_user varbinary(1000) comment ‘店铺负责人’
                    */

                    dianbu_name : "",
                    dianbu_des : "",
                    dianbu_user :   this.$store.state.user.user_name // uni.getStorageSync("user").user_name
                }
            };
        },
        async onLoad(e) {
            let data = await this.$httpApi.query({
                '{}':{
                    "id":id
                }
            });
            console.log(data);
            this.dianbu = data['{}'];

        },
        methods: {
            goDianPu: function() {
                this.$httpApi.insert("Sp_dianbu" ,this.dianbu);
                const time = 2000;
                // uni.showToast({
                // 	title: '创建店铺成功',
                // 	duration: time
                // })
                // setTimeout( ()=>{
                // 	uni.switchTab({
                // 		url: '/pages/index/index'
                // 	})
                // },time);
                // this.navigateTo('/pages/index/index' , 'wode12344');
                // this.$uniApp.invokeSetTimeout('switchTab',{url: '/pages/index/index'},'wode12344');
                this.switchTab('/pages/index/index' , '创建店铺成功.');
            },
            /* setTimeout : function(method,methodData,title,time = 2000){
                if(title){
                    uni.showToast({
                        title: title,
                        duration: time
                    })
                    setTimeout( ()=>{
                        uni[method](methodData)
                    },time);
                }else{
                    uni[method](methodData);
                }

             } */

        }
    }
</script>

<style>
    .cu-form-group .title {
        min-width: calc(4em + 15px);
    }
</style>
